package Lecture9;

import java.util.Arrays;
import java.util.Scanner;

public class array {

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner (System.in);

		int[] array = new int[0];

		int a = sc.nextInt();

		while( a != 0){
		
		int[] array1 = new int [array.length + 1];
		
		for(int i = 0; i < array.length; i++)
		{
			array1[i] = array[i];
		}
		
		array1[array.length] = a;

		System.out.println(Arrays.toString(array1));

		array = array1;
		System.out.println(Arrays.toString(array));
		
		a = sc.nextInt();
		}
		System.out.println("Exit");
	}

}
